var xmlHttp;
function check_department()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 
	var url="backstage/admin_department.php";
	url=url+"?do=query";
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function check_pass(str)
{
	if (str.length == 0)
	{
		document.getElementById("user_pass").innerHTML = "* 密码不能为空！";
		return;
	}
	if (str.length < 4 || str.length > 30)
	{
		document.getElementById("user_pass").innerHTML = "* 密码长度不符合要求！";
		return;
	}
	else
	{
		document.getElementById("user_pass").innerHTML = "* 密码可用!";
		return;
	}
}
function check_true_pass(str)
{
	if (str == document.reg.password.value)
	{
		document.getElementById("user_truepass").innerHTML = "* 密码一致！";
		return;
	}
	else
	{
		document.getElementById("user_truepass").innerHTML = "* 密码不一致！";
		return;
	}
}
function check_reg()
{
	var username = document.reg.username.value;
	var password = document.reg.password.value;
	var password2 = document.reg.password2.value;
	if (username.length == 0)
	{
		document.getElementById("user_info").innerHTML="* 不能为空！";
		return false;
	}
	else
	{
		if (username.length < 4 || username.length > 30)
		{
			document.getElementById("user_info").innerHTML="* 长度应为4~30个字符！";
			return false;
		}
	}
	if (password.length == 0)
	{
		document.getElementById("user_pass").innerHTML = "* 密码不能为空！";
		return false;
	}
	else
	{
		if (password.length < 4 || password.length > 30)
		{
			document.getElementById("user_pass").innerHTML = "* 密码长度不符合要求！";
			return false;
		}
	}
	if (password != password2)
	{
		document.getElementById("user_truepass").innerHTML = "* 密码不一致！";
		return false;
	}
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("user_info").innerHTML=xmlHttp.responseText;
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}